feat: Add support for ERC-8132: Gas Limit Override Capability#238
feat: Add support for ERC-8132: Gas Limit Override Capability#238ajhodges wants to merge 8 commits intobase:masterfrom
Conversation
🟡 Heimdall Review Status
|
There was a problem hiding this comment.
Pull request overview
Implements ERC-8132-style per-call gasLimitOverride support for wallet_sendCalls, including capability advertisement, validation, and forwarding/aggregation when routing calls through the global account.
Changes:
- Advertises
gasLimitOverride: { supported: true }under the0x0(all chains) key inwallet_getCapabilities. - Adds RPC/types for per-call capabilities (
gasLimitOverride) and threads them throughwallet_sendCalls→wallet_prepareCalls. - Validates per-call
gasLimitOverride.valuein the sub-account signer and aggregates per-call gas overrides onto the routedexecuteBatchcall.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/account-sdk/src/sign/base-account/utils/routeThroughGlobalAccount.ts | Aggregates per-call gas limit overrides onto the routed executeBatch call when using the global account. |
| packages/account-sdk/src/sign/base-account/utils/routeThroughGlobalAccount.test.ts | Adds unit tests for aggregation/estimation behavior and propagation of aggregated override. |
| packages/account-sdk/src/sign/base-account/utils/createSubAccountSigner.ts | Adds client-side validation for gasLimitOverride.value (hex + non-zero) and forwards per-call capabilities. |
| packages/account-sdk/src/sign/base-account/utils/createSubAccountSigner.test.ts | Adds unit tests for gas limit override validation/pass-through. |
| packages/account-sdk/src/sign/base-account/utils.ts | Updates request helper typing to allow per-call capabilities. |
| packages/account-sdk/src/sign/base-account/Signer.ts | Always includes 0x0.gasLimitOverride in wallet_getCapabilities and ensures it survives filtering. |
| packages/account-sdk/src/sign/base-account/Signer.test.ts | Updates/adds tests to cover 0x0 wildcard capability behavior. |
| packages/account-sdk/src/core/rpc/wallet_sendCalls.ts | Introduces CallCapabilities and gasLimitOverride types for wallet_sendCalls. |
| packages/account-sdk/src/core/rpc/wallet_prepareCalls.ts | Extends PrepareCallsCall to include per-call capabilities. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/account-sdk/src/sign/base-account/utils/routeThroughGlobalAccount.ts
Show resolved
Hide resolved
| } from '../utils.js'; | ||
| import { createSmartAccount } from './createSmartAccount.js'; | ||
|
|
||
| function validateGasLimitOverrides(calls: { capabilities?: CallCapabilities }[]): void { |
There was a problem hiding this comment.
why do we only run this validation for sub account sendCalls requests?
There was a problem hiding this comment.
For the global account (popup) path, the wallet_sendCalls request is forwarded as-is to keys.coinbase.com - validation happens server-side. We only need client-side validation in the sub-account path because that's where the SDK constructs the UserOp directly.
Summary
Implements ERC-8132 Gas Limit Override capability, allowing apps to specify per-call gas limits in
wallet_sendCalls.Resolves BA-3860
Changes:
wallet_getCapabilitiesnow returnsgasLimitOverride: { supported: true }under the0x0wildcard key (all chains)GasLimitOverrideCallCapability,CallCapabilities, andWalletSendCallsCalltypes inwallet_sendCalls.ts;PrepareCallsCallupdated to include per-callcapabilitiesvalidateGasLimitOverrides()in the sub-account signer validates each call'sgasLimitOverride.valueis valid hex and non-zero, returning-32602on failurewallet_sendCalls→wallet_prepareCalls→ bundler RPCexecuteBatch, per-call gas limit overrides are aggregated (witheth_estimateGasfor calls without an override) and set on the batch call sent to the popup. Batch overhead uses backend-aligned buffer params (500 gas/call safety buffer+2 gas/byte input data cost)How did you test your changes?
wallet_getCapabilitiesgasLimitOverride advertisement inSigner.test.tscreateSubAccountSigner.test.tsrouteThroughGlobalAccount.test.tstsc --noEmittype-check